package com.taotao.web;

import com.taotao.common.pojo.PictureResult;
import com.taotao.service.PictureService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * PictureController
 * Created by heqianqian on 2017/7/7.
 */
@Controller
@RequestMapping("/pic")
public class PictureController {

    @Resource
    private PictureService pictureService;

    /**
     * 上传图片
     *
     * @param uploadFile 上传文件
     * @return PictureResult
     */
    @ResponseBody
    @RequestMapping("/upload")
    public PictureResult uploadPic(MultipartFile uploadFile) {
        System.out.println("上传图片！");
        return pictureService.uploadFile(uploadFile);
    }

}
